package test;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {
        List list = new LinkedList();
        list.add("张飞");
        list.add(0,"刘备");
        System.out.println(list);
        ArrayList arrayList = new ArrayList();
        arrayList.add("关羽");
        arrayList.add("赵云");
        arrayList.add(1,"黄忠");
        list.addAll(1,arrayList);
        System.out.println(list);
        System.out.println(list.get(2));
        System.out.println(list.indexOf("赵云"));
        System.out.println(list.lastIndexOf("刘备"));
        list.remove("黄忠");
        System.out.println(list);
        list.set(2,"张飞");
        System.out.println(list);
        System.out.println(list.subList(0, 3));

    }
}
